////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
// All Rights Reserved.
// The following is Sample Code and is subject to all restrictions on such code
// as contained in the End User License Agreement accompanying this product.
// If you have received this file from a source other than Adobe,
// then your use, modification, or distribution of it requires
// the prior written permission of Adobe.
//
////////////////////////////////////////////////////////////////////////////////
package samples.photoviewer
{
	import mx.collections.ArrayCollection;
	
	[Bindable]
	public class Paging
	{
		public var name:String;
		public var nquery:String;
		public var pquery:String;
		//public var fnext:String;
		//public var fprevious:String;
		//public var description:String;
		//public var photos:ArrayCollection;
		public var pages:ArrayCollection;
		public var current:String;

		//private var photo:Photo;
		private var page:Page;
		
		public function Paging(paging:Object=null)
		{
			//photos = new ArrayCollection();
			pages = new ArrayCollection();
			if (paging != null)
			{
				fill(paging);
			}
		}
		
		public function fill(paging:Object):void
		{
			this.name = "";
			this.current = paging.current;
			this.nquery = paging.next;
			this.pquery = paging.previous;
			//this.fnext = paging.fnext;
			//this.fprevious = paging.fprevious;
			//this.description = paging.d;
			//this.selected = 0;

			//added on 20090203 -- paging
			for (var j:int=0; j < paging.page.length; j++)
			{
				page = new Page(paging.page[j]);
				pages.addItem(page);
			}
		}
	}
}